package com.xoa.controller.task;


import com.xoa.model.task.TaskType;
import com.xoa.service.task.TaskTypeService;
import com.xoa.util.ToJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 *<p>
 *  任务类型控制层
 *</p>
 *@author 王禹萌
 *@since  2019-12-21
 */
@Controller
@RequestMapping("/taskClass")
public class TaskTypeController {

    @Autowired
    private TaskTypeService taskTypeService;

    /**
     * 增加任务类型
     * @param request
     * @param className
     * @return
     */
    @ResponseBody
    @RequestMapping("/addTaskClass")
    public ToJson addTaskClass(HttpServletRequest request, String className){

        return taskTypeService.addTaskClass(request,className);
    }

    /**
     * 删除任务类型
     * @param request
     * @param typeId
     * @return
     */
    @ResponseBody
    @RequestMapping("/delTaskClass")
    public ToJson delTaskClass(HttpServletRequest request, int typeId){
       return taskTypeService.delTaskClass(request,typeId);
    }

    @ResponseBody
    @RequestMapping("/updateTaskClass")
    public ToJson updateTaskClass(HttpServletRequest request, TaskType taskType){
        return taskTypeService.updateTaskClass(request,taskType);
    }

    /**
     * 查询该用户负责的任务
     * @param request
     * @return
     */
    @ResponseBody
    @RequestMapping("/queryTaskClass")
    public ToJson queryTaskClass(HttpServletRequest request){
        return taskTypeService.queryTaskClass(request);
    }



}


















